<!--  流量共享  -->

<template>
	<view class="trafficShare">

		<view class="trafficShare_content" v-if="true">
			<view class="trafficShare_content_item" v-for="(item,index) in dataList" :key='index'>
				<view class="flex-c-c trafficShare_content_item_item">
					<view class="trafficShare_content_item_item">类型：{{tgType(item.channel)}}</view>
					<view class="trafficShare_content_item_delete" @click="onDelete(item.pk_id)">删除</view>
				</view>
				<u-line color="#eeeeee" margin="30rpx 0"></u-line>
				<view class="trafficShare_content-bottom">
					<view class="t_content-bottom">
						<view class="u-m-b-20">标题名称：{{item.name}}</view>
						<view class="u-m-b-20">用户标签：{{item.tag}}</view>
						<view class="u-m-b-15">推广海报</view>
					</view>
					<view class="t_content_b_list">
						<view class="t_content_b_list_img" v-for="(i,index) in item.imgList" :key='index'>
							<image :src="i" class="t_content_img"></image>
						</view>
						<!-- 占位置 -->
						<view class="t_content_b_list_img" v-for="(e,index) in 3-(item.imgList.length%3)" :key='index'></view>
					</view>
					<view class="">
						<view class="t_content_b_list-title">
							推广文案：
						</view>
						<view class="t_content_b_list-t-content">
							{{item.remark}}
						</view>
					</view>

				</view>
			</view>
		</view>

		<view class="list_message" v-else>
			<u-empty text="暂无数据" mode="list"></u-empty>
		</view>
	</view>
</template>

<script>
	import {
		pagingMixin
	} from '@/mixins/sysPaging.js'
	import {
		uniModal
	} from '@/utils/uniPromise'
	export default {
		mixins: [pagingMixin],
		data() {
			return {

			}
		},
		onLoad(options) {
			this.initPage()
		},
		computed: {
			tgType(data) {
				return function(data) {
					if (data == 1) {
						return '站内消息'
					} else if (data == 2) {
						return '短信推广'
					} else {
						return '微信推广'
					}
				}
			},
		},
		methods: {
			initPage() {
				this._init_data('', {
					fk_business_id: this.vuex_adminuser.pk_id,
				}, {
					name: 'b_chain_extension',
					callBack: function(res) {
						return res.map(el => {
							if (el.img[0]) {
								el.imgList = el.img.split(',')
							}
							return el
						})
					}
				})
			},

			onDelete(pk_id) {
				uniModal({
					title: '是否刪除'
				}).then(res => {
					uni.showLoading({
						title: '正在刪除'
					})
					this.$DeleteManagerData(56, pk_id).then(res => {
						uni.hideLoading()
						this.initPage()
					}).catch(() => {
						uni.hideLoading()
						this.$toast('删除失败')
						this.initPage()
					})

				})

			},
			$onReachBottom() {
				this._load_data({
					name: 'b_chain_extension'
				})
			},


		}
	}
</script>

<style lang='scss' scoped>
	.flex-c-c {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.trafficShare_content {
		min-height: calc(100vh - 80rpx - 112rpx);
		background-color: #f5f5f5;
		padding: 20rpx;
		box-sizing: border-box;
	}

	.trafficShare_content_item {
		width: 100%;
		padding: 33rpx 20rpx;
		background-color: #ffffff;
		border-radius: 8rpx;
		margin-bottom: 22rpx;
	}

	.trafficShare_content_item_item {
		position: relative;
	}

	.trafficShare_content_item_item::after {
		content: '';
		position: absolute;
		height: 80%;
		width: 10rpx;
		left: -20rpx;
		top: 0;
		bottom: 0;
		margin: auto 0;
		background-color: #3297EF;
	}

	.trafficShare_content_item_delete {
		font-size: 28rpx;
		color: #FF1515;
		font-weight: 500;
	}


	.t_content-bottom {
		font-size: 26rpx;
		color: #999999;
	}

	.t_content_b_list {
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
	}

	.t_content_b_list_img {
		width: calc(100% / 3 - 13.3rpx);
		height: 208rpx;
		margin-bottom: 24rpx;
	}

	.t_content_img {
		width: 100%;
		height: 100%;
		border-radius: 8rpx;
	}

	.t_content_b_list-title {
		display: inline-block;
		width: 150rpx;
		vertical-align: top;
	}

	.t_content_b_list-t-content {
		display: inline-block;
		width: calc(100% - 150rpx);
	}


	.list_message {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		min-height: calc(100vh - 80rpx - 112rpx);
	}

	.trafficShare_search_input {
		margin-left: 14rpx;
		width: calc(100% - 14rpx);
		height: 100%;
	}
</style>
